Skip to content

docs: deduplicate stats docstrings and link to algorithms (#621)#726

Merged
leotrs merged 1 commit into
mainfrom
stats-docstring-deduplication
May 28, 2026
Merged

docs: deduplicate stats docstrings and link to algorithms (#621)#726
leotrs merged 1 commit into
mainfrom
stats-docstring-deduplication

Conversation

@leotrs

@leotrs leotrs commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #621. Several stats (in xgi.stats.nodestats and xgi.stats.edgestats) are thin wrappers around xgi.algorithms functions but were carrying their own copies of formulas, references, and notes. Those copies had drifted from the originals.

This PR makes the algorithms module the single source of truth:

  • Wrapper stat docstrings now point at the corresponding algorithm via See Also rather than re-explaining
  • Each algorithm gets a short note mentioning its stat accessor (e.g., "Also accessible via the stats interface as H.nodes.clustering_coefficient") so users find both calling conventions from either direction

Combined with the docstring forwarding from #708, H.nodes.clustering_coefficient? now shows the short pointer doc instead of duplicated content, and one click takes you to the authoritative algorithm doc.

Affects: clustering_coefficient, local_clustering_coefficient, two_node_clustering_coefficient, clique_eigenvector_centrality, h_eigenvector_centrality, z_eigenvector_centrality, node_edge_centrality (node and edge), katz_centrality, and the three local simpliciality stats.

Test plan

  • Full test suite passes (409 passed, 6 skipped)
  • Verified forwarded docstrings render correctly via H.nodes.<stat>.__doc__

Several stats are thin wrappers around xgi.algorithms functions but were
carrying their own copies of the formulas, references, and notes. Those
copies had drifted from the originals.

Rewrites the wrapper stat docstrings to point at the algorithm via
See Also rather than re-explaining. Adds a short stat-accessor note to
each algorithm so users discover both calling conventions from either
direction.

Affects clustering_coefficient, local_clustering_coefficient,
two_node_clustering_coefficient, clique_eigenvector_centrality,
h_eigenvector_centrality, z_eigenvector_centrality, node_edge_centrality,
katz_centrality, and the local simpliciality stats.

Closes #621

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@leotrs leotrs mentioned this pull request May 28, 2026
@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.68%. Comparing base (b7a899d) to head (61603ec).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #726   +/-   ##
=======================================
  Coverage   93.68%   93.68%           
=======================================
  Files          66       66           
  Lines        5207     5207           
=======================================
  Hits         4878     4878           
  Misses        329      329           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maximelucas

Copy link
Copy Markdown
Collaborator

Amazing!! Thanks Leo

@leotrs leotrs merged commit e2ccb1f into main May 28, 2026
17 checks passed
@maximelucas

Copy link
Copy Markdown
Collaborator

@leotrs @kaiser-dan same, this was merged into main

@leotrs

leotrs commented May 29, 2026

Copy link
Copy Markdown
Collaborator Author

Acknowledged — see my reply on #727. All recovered via backmerge.

@maximelucas maximelucas deleted the stats-docstring-deduplication branch June 1, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve stats docstrings

2 participants